package container

import (
	"github.com/liyaozong/mengo/common/di"
	"github.com/liyaozong/mengo/core/base/interfaces"
)

// ConfigurationInterfaceName contains the name of the interfaces.Configuration implementation in the DIC.
var ConfigurationInterfaceName = di.TypeInstanceToName((*interfaces.Configuration)(nil))

// ConfigurationFrom helper function queries the DIC and returns the interfaces.Configuration implementation.
func ConfigurationFrom(get di.Get) interfaces.Configuration {
	configuration, ok := get(ConfigurationInterfaceName).(interfaces.Configuration)
	if !ok {
		return nil
	}

	return configuration
}
